import { createRouter, createWebHistory } from "vue-router";

//张
import album_info from "../views/album_info";
import search_page from "../views/search_page.vue";
import search_music from "../components/search/search_music.vue";
import search_playlist from "../components/search/search_playlist.vue";
import search_album from "../components/search/search_album.vue";
import search_user from "../components/search/search_user.vue";
import play_page from "../views/play_page.vue";
// 符
import mainPage from "../views/mainPage.vue";
import register from "../views/register.vue";
import loginPwd from "../views/login_pwd.vue";
import loginCode from "../views/login_code.vue";
import info from "../views/info.vue";
const routes = [
  // 张

  {
    path: "/album_info",
    component: album_info,
  },
  {
    path: "/play_page",
    component: play_page,
  },
  {
    path: "/search_page",
    component: search_page,
    redirect: '/search_music',//默认打开search_music路由
    children: [
      {
        path: "/search_music",
        name: 'search_music',
        component: search_music,
      },
      {
        path: "/search_playlist",
        name: 'search_playlist',
        component: search_playlist,
      },
      {
        path: "/search_album",
        name: 'search_album',
        component: search_album,
      },
      {
        path: "/search_user",
        name: 'search_user',
        component: search_user,
      },
    ]
  },

  //符
  {
    path: "/info",
    component: info,
  },
  {
    path: "/loginCode",
    component: loginCode,
  },
  {
    path: "/loginPwd",
    component: loginPwd,
  },
  {
    path: "/",
    redirect: "/mainPage",
  },
  {
    path: "/mainPage",
    component: mainPage,
  },
  {
    path: "/register",
    component: register,
  },
];

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes,
});

export default router;
